package roborally.program.conditions;

import roborally.model.Robot;
import roborally.program.ProgramElement;

/**
 * A class for dealing with conditions for executing a command.  
 * 
 * @version	1.0
 * @author  Pieter Robberechts	(1e Bach Informatica)
 * @author	Jeroen Sanders		(1e Bach Informatica)
 *
 */
public abstract class Condition extends ProgramElement {

	/**
	 * Initialize this new condition with a line number.
	 * 
	 */
	public Condition(int lineNb) {
		super(lineNb);
	}

	/**
	 * Evaluate this condition for a given robot.
	 * 
	 * @param 	robot
	 * 			The robot for which the condition should be evaluated.
	 * @return	Return true if and only if the given robot is not null and 
	 * 			is placed on a board; else return false.
	 * 			| result == (robot != null) && (robot.getBoard() != null)
	 */
	public boolean evaluate(Robot robot) {
		return (robot != null) && (robot.getBoard() != null);
	}
	
}
